package com.yisu.job;

import com.dangdang.ddframe.job.api.JobExecutionMultipleShardingContext;
import com.dangdang.ddframe.job.plugin.job.type.simple.AbstractSimpleElasticJob;
import com.yisu.expressway.ewf.common.spring.SpringContext;
import com.yisu.job.service.IOrderMainService;

/**
 * Created by nichole on 2016/12/17.
 */
public class CancelNonPaymentOrderJob extends AbstractSimpleElasticJob {

    @Override
    public void process(JobExecutionMultipleShardingContext context) {
        IOrderMainService iOrderMainService = SpringContext.getBean(IOrderMainService.class);
        int cancelTimeLimit = SpringContext.getBean(JobConfig.class).getCancelTimeLimit();
        if(cancelTimeLimit == 0) {
            cancelTimeLimit = 30;
        }
        iOrderMainService.cancelOrder(cancelTimeLimit);
    }
}
